//
// Created by xili on 2024/8/21 18:52.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    int maxDistance(vector<int> &nums1, vector<int> &nums2) {
        int maxDist = 0;
        int i = 0, j = 0;
        while (i < nums1.size() && j < nums2.size()) {
            if (nums1[i] <= nums2[j]) {
                maxDist = max(maxDist, j - i);
                j++;
            } else {
                i++;
            }
        }
        return maxDist;
    }
};